#ifndef __HFUNCTIONTABLE_H__
#define __HFUNCTIONTABLE_H__

#include <string>
#include "HSymbolTable.h"
#include "CACT-Type.h"

// number of builtin functions
#define BUILTIN_NUM 7U

// Function table entry
struct HFTEntry {
	std::string funcid;		// name
	Btype rettype;			/// return value type
	std::vector<const cact_type_t *> paramtype;	// parameters list
	HSymbolTable *psymtb;	// symbol table
};

class HFunctionTable {
private:
	std::vector<HFTEntry> _funcs;
	static unsigned int ymr;	// count
public:
	HFunctionTable();
	size_t add_func(const std::string &id, Btype rtype, HSymbolTable *psymtb,
		const std::vector<const cact_type_t *> &paramtype);
	const std::vector<HFTEntry> &funcs() const { return _funcs; }
	const HFTEntry &func(size_t idx) const { return _funcs.at(idx); }
	size_t search_func(const std::string &id) const;
	~HFunctionTable();
};

#endif